package com.holyn.guofang.model.webhttp;

import android.content.res.Resources;
import com.holyn.guofang.R;
//import static com.holyn.guofang.R.string.base_url;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Holyn on 2017/4/27.
 */

public class HttpConfigure {
    //get
    //http://shjs.iketong.cn/handler/login.ashx?
    // equipmentCode=902C9190-57DF-4551-83D6-38A9F9E5CA12
    // &password=95cb2996ba5cd7d68153d30ff5433fee
    // &checkCode=e0feb5a3546944ea00c711d011d483db
    // &userName=holyn%20
    // &isWeb=0
    // &rand=UVJIKN
    // &platformType=2
    // &

//    public static final String BASE_URL = "http://192.168.1.250:82/";
//    public static final String BASE_URL = "http://server.jeasonlzy.com/OkHttpUtils/";//upload.download


    public final static String URL_WEI_XIN = "http://dldir1.qq.com/weixin/android/weixin6330android920.apk";
    public final static String URL_QQ = "https://qd.myapp.com/myapp/qqteam/AndroidQQ/mobileqq_android.apk";

//    public static final String BASE_URL = "http://shjs.iketong.cn/handler/";//国方
//http://192.168.0.232/handler/SubmitQrCode.ashx
    //国方基础域名（服务器连接设置）
//    public static final String BASE_URL = "http://192.168.0.232/handler/";
    public static final String BASE_URL = "http://tm.tmhelper.cn/handler/";
//    public static final String BASE_URL = "http://119.145.147.169:8080/handler/";
//    public static final String BASE_URL = "@string/base_url";
//    public static final String BASE_URL = Resources.getSystem().getString(R.string.base_url);
//    public static final String BASE_URL = getString(base_url);
    public static boolean IS_DEBUG = false;

    /**
     * 注册-成功返回：status 操作是否成功(1:是，0:否，-1:账号重复，-2: 手机号码重复，-3:电子重复，-4:验证码不匹配， -5:手机或 EMAIL 接收到的验证码不匹配)
     *
     * 注册-获取验证码-成功返回：status 操作是否成功(1:是，0:否，-1:账号重复，-2: 手机号码重复，-3:电子邮箱重复，-4:验证码不匹 配，-5:验证次数超过限制，-6:一分钟内请求超过 1次)
     */
    public static final int STATUS_SUCCESS = 1;
    public static final int STATUS_ERROR = 0;
    public static final int STATUS_ACOUNT_REPEAT = -1;
    public static final int STATUS_MOBILE_REPEAT = -2;
    public static final int STATUS_EMAIL_REPEAT = -3;
    public static final int STATUS_VAILD_CODE_ERROR = -4;
    public static final int STATUS_MOBILE_OR_EMAIL_ERROR = -5;
    public static final int STATUS_VAILD_CODE_EXCEED = -5;
    public static final int STATUS_VAILD_CODE_ONCE_ERROR = -6;

    /**
     * 登录-成功返回：(1:是，0:否，-1:账号或密码错误， -2:需要验证(此时需要给用户输入验证码，输入 验证码后调用接口 2.3.4)，
     *                      -3:验证码不匹配，-4: 设备授权已达上限，-5:已有其他用户绑定了该设备并授权，-6:同一设备一分钟内验证超过 1 次，-7: 需要先授权设备)
     */
    public static final int STATUS_ACOUNT_OR_PASSWORD_ERROR = -1;
    public static final int STATUS_NEED_VALID_CODE = -2;
    public static final int STATUS_LOGIN_VALID_CODE_ERROR = -3;
    public static final int STATUS_EDEVICE_AUTHORIZE_MAX_ERROR = -4;
    public static final int STATUS_EDEVICE_HAS_AUTHORIZE_ERROR = -5;
    public static final int STATUS_EDEVICE_AUTHORIZE_EXCEED_ERROR = -6;
    public static final int STATUS_EDEVICE_NEED_AUTHORIZE = -7;
    public static String getLoginStatusMsg(int status, String defaultError){
        switch (status){
            case STATUS_SUCCESS:
                return "登录成功";
            case STATUS_ERROR:
                return "登录失败";
            case STATUS_ACOUNT_OR_PASSWORD_ERROR:
                return "账号或密码错误";
            case STATUS_NEED_VALID_CODE:
                return "需要验证";
            case STATUS_LOGIN_VALID_CODE_ERROR:
                return "验证码不匹配";
            case STATUS_EDEVICE_AUTHORIZE_MAX_ERROR:
                return "设备授权已达上限";
            case STATUS_EDEVICE_HAS_AUTHORIZE_ERROR:
                return "已有其他用户绑定了该设备并授权";
            case STATUS_EDEVICE_AUTHORIZE_EXCEED_ERROR:
                return "同一设备一分钟内验证超过1次";
            case STATUS_EDEVICE_NEED_AUTHORIZE:
                return "需要先授权设备";
        }
        return defaultError;
    }

    /**
     * platformType 平台类型(1:IOS 以外平台，2:IOS)
     */
    public static final Integer PLATFORM_TYPE_ANDROID = 1;

    /**
     * isWeb 是否为网页端登录(1:是，0:否)
     */
    public static final Integer IS_WEB_FALSE = 0;

    /**
     * android平台验证码platformCheckCode ：notiossdu76yhnbgfi98
     */
    public static final String PLATFORM_CHECK_CODE = "notiossdu76yhnbgfi98";

    /**
     * 更换主设备后进行登录验证-成功返回：(1:是，0:否，-1:账号错误，-2:手 机号码或电子邮箱接收到的验证码不匹配，-3:验证码不匹配，-4:用户登录信息不存在)
     */
    public static String getLoginCheckStatusMsg(int status, String defaultError){
        switch (status){
            case STATUS_SUCCESS:
                return "更换主设备登录成功";
            case STATUS_ERROR:
                return "更换主设备登录失败";
            case -1:
                return "账号错误";
            case -2:
                return "手机号码或电子邮箱接收到的验证码不匹配";
            case -3:
                return "验证码不匹配";
            case -4:
                return "用户登录信息不存在";
        }
        return defaultError;
    }

    public static void init(boolean isDebug) {
        IS_DEBUG = isDebug;
    }

}
